﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LotteryVote.Entity
{
    /// <summary>
    /// 注单
    /// </summary>
    public class BetSheet : IEntity
    {
        public const string TABLENAME = "tb_BetSheet";
        public const string SHEETID = "SheetId";
        public const string USERID = "UserId";
        public const string NUM = "Num";
        public const string STATUS = "Status";
        public const string IPADDRESS = "IPAddress";
        public const string CREATETIME = "CreateTime";

        public int SheetId { get; set; }
        public int UserId { get; set; }
        public string Num { get; set; }
        public BetStatus Status { get; set; }
        /// <summary>
        /// 总下注额（根据BetOrder计算）.
        /// </summary>
        /// <value>
        /// The turnover.
        /// </value>
        public decimal Turnover { get; set; }
        /// <summary>
        /// 总佣金（根据BetOrder计算）
        /// </summary>
        /// <value>
        /// The commission.
        /// </value>
        public decimal Commission { get; set; }
        /// <summary>
        /// 净金额（根据BetOrder计算）.
        /// </summary>
        /// <value>
        /// The net amount.
        /// </value>
        public decimal NetAmount { get; set; }
        public string IPAddress { get; set; }
        public DateTime CreateTime { get; set; }
        public bool CanCancel
        {
            get
            {
                //TODO:应该使用配置
                return Status == BetStatus.Valid && CreateTime.AddMinutes(5) > DateTime.Now;
            }
        }
        public User User { get; set; }
    }
}
